import 'package:http/http.dart' as http;
import 'dart:core';
import 'dart:convert';

// https://httpbin.org/ip 返回ip地址

Future getIpAddress() {
  final url = Uri.parse('https://httpbin.org/ip');
  return http.get(url).then((response) {
    // print(response.body);
    String ip = jsonDecode(response.body)['origin'];
    return ip;
  });
}

void main(List<String> args) {
  getIpAddress().then((ip) => print(ip)).catchError((err) => print(err));
}
